/*
 * Copyright (c) 2013 WDCY Information Technology Co. Ltd
 * www.wdcy.cc
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * WDCY Information Technology Co. Ltd ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with WDCY Information Technology Co. Ltd.
 */
package com.monkey.web.dto.request.role;

import com.monkey.core.domain.role.Role;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 * @author Wu Tianqiang
 */
public class AddRoleRequestDto {
    @NotEmpty(message = "add.role.name.not.null")
    private String name;

    @NotEmpty(message = "add.role.not.null")
    private String role;

    private String description;

    /**
     * key   : resourceId
     * value : permissionIds   多个用逗号隔开
     */
    @NotNull(message = "add.role.authorizations.not.null")
    private Map<Long, String> authorizations;

    public AddRoleRequestDto() {
    }

    public Role toRole() {
        Role role = new Role();
        role.setName(this.name);
        role.setRole(this.role);
        role.setDescription(this.description);
        return role;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Map<Long, String> getAuthorizations() {
        return authorizations;
    }

    public void setAuthorizations(Map<Long, String> authorizations) {
        this.authorizations = authorizations;
    }
}